 
task Shot//CVbg̃^XNB
{

let Damage=1.9;

let BL1=1.2;
let BL2=1.5;
let BL3=1.5;
loop
{
		if((GetKeyState(VK_SHOT)==KEY_PUSH || GetKeyState(VK_SHOT)==KEY_HOLD) && shotCount==-1 && !OnMissed && GetCommonDataDefault("TitleMenu",false)==false)
		{
			shotCount = 0;
		}
			if(shotCount%3 == 0)
			{
				if(!OnMissed  && GetCommonDataDefault("TitleMenu",false)==false)
				{
					PlaySE(SE[2]);
				}
				if(BurstLevel==0)
				{
					MarisaShot(GetPlayerX+10,GetPlayerY+5,24,270,Damage,2);
					MarisaShot(GetPlayerX-10,GetPlayerY+5,24,270,Damage,2);
				}

				if(BurstLevel==3)
				{
					MarisaShot(GetPlayerX+10,GetPlayerY+5,24,270,Damage*BL3,3);
					MarisaShot(GetPlayerX-10,GetPlayerY+5,24,270,Damage*BL3,3);
				}
			}
		if(shotCount >= 0)
		{
			shotCount++;
		}
		if(shotCount == 9)
		{
			shotCount=-1;
		}
yield;
}
}

task SubShot//IvṼVbgBAᑬŕωB
{
let a=7.5;

let HiDamage=0.95;
let LowDamage=0.95;

let AdjustX=5;
let AdjustY=0;
let Grad=10;

let BL1=1.2;
let BL2=1.5;
let BL3=1.5;
loop
{
		if((GetKeyState(VK_SHOT)==KEY_PUSH || GetKeyState(VK_SHOT)==KEY_HOLD) && shotCount==-1)
		{
			shotCount = 0;
		}
		if(GetKeyState(VK_SLOWMOVE)==KEY_PUSH || GetKeyState(VK_SLOWMOVE)==KEY_HOLD)
		{
			if(shotCount%3 == 0)
			{
				if(BurstLevel==0)
				{
				MarisaShot(opX[0]-AdjustX,opY[0]+AdjustY,24,270,LowDamage,2);
				MarisaShot(opX[1]-AdjustX,opY[1]+AdjustY,24,270,LowDamage,2);
				MarisaShot(opX[2]-AdjustX,opY[2]+AdjustY,24,270,LowDamage,2);
				MarisaShot(opX[3]-AdjustX,opY[3]+AdjustY,24,270,LowDamage,2);

				MarisaShot(opX[0]+AdjustX,opY[0]+AdjustY,24,270,LowDamage,2);
				MarisaShot(opX[1]+AdjustX,opY[1]+AdjustY,24,270,LowDamage,2);
				MarisaShot(opX[2]+AdjustX,opY[2]+AdjustY,24,270,LowDamage,2);
				MarisaShot(opX[3]+AdjustX,opY[3]+AdjustY,24,270,LowDamage,2);

				}

				if(BurstLevel==3)
				{
				MarisaShot(opX[0]-AdjustX,opY[0]+AdjustY,24,270,LowDamage*BL3,3);
				MarisaShot(opX[1]-AdjustX,opY[1]+AdjustY,24,270,LowDamage*BL3,3);
				MarisaShot(opX[2]-AdjustX,opY[2]+AdjustY,24,270,LowDamage*BL3,3);
				MarisaShot(opX[3]-AdjustX,opY[3]+AdjustY,24,270,LowDamage*BL3,3);

				MarisaShot(opX[0]+AdjustX,opY[0]+AdjustY,24,270,LowDamage*BL3,3);
				MarisaShot(opX[1]+AdjustX,opY[1]+AdjustY,24,270,LowDamage*BL3,3);
				MarisaShot(opX[2]+AdjustX,opY[2]+AdjustY,24,270,LowDamage*BL3,3);
				MarisaShot(opX[3]+AdjustX,opY[3]+AdjustY,24,270,LowDamage*BL3,3);
				}
			}
		}
		else
		{
			if(shotCount%3 == 0)
			{
				if(BurstLevel==0)
				{
				MarisaShot(opX[0]-AdjustX,opY[0]+AdjustY,24,270,LowDamage,2);
				MarisaShot(opX[1]-AdjustX,opY[1]+AdjustY,24,270,LowDamage,2);
				MarisaShot(opX[2]-AdjustX,opY[2]+AdjustY,24,270,LowDamage,2);
				MarisaShot(opX[3]-AdjustX,opY[3]+AdjustY,24,270,LowDamage,2);

				MarisaShot(opX[0]+AdjustX,opY[0]+AdjustY,24,270,LowDamage,2);
				MarisaShot(opX[1]+AdjustX,opY[1]+AdjustY,24,270,LowDamage,2);
				MarisaShot(opX[2]+AdjustX,opY[2]+AdjustY,24,270,LowDamage,2);
				MarisaShot(opX[3]+AdjustX,opY[3]+AdjustY,24,270,LowDamage,2);

				}

				if(BurstLevel==3)
				{
				MarisaShot(opX[0]-AdjustX,opY[0]+AdjustY,24,270,LowDamage*BL3,3);
				MarisaShot(opX[1]-AdjustX,opY[1]+AdjustY,24,270,LowDamage*BL3,3);
				MarisaShot(opX[2]-AdjustX,opY[2]+AdjustY,24,270,LowDamage*BL3,3);
				MarisaShot(opX[3]-AdjustX,opY[3]+AdjustY,24,270,LowDamage*BL3,3);

				MarisaShot(opX[0]+AdjustX,opY[0]+AdjustY,24,270,LowDamage*BL3,3);
				MarisaShot(opX[1]+AdjustX,opY[1]+AdjustY,24,270,LowDamage*BL3,3);
				MarisaShot(opX[2]+AdjustX,opY[2]+AdjustY,24,270,LowDamage*BL3,3);
				MarisaShot(opX[3]+AdjustX,opY[3]+AdjustY,24,270,LowDamage*BL3,3);
				}
			}
		}
yield;
}
}

task MarisaShot(let x,let y,let speed,let angle,let damage,let Type)
{

	let obj = Obj_Create(OBJ_SHOT);
	Obj_SetPosition(obj,x,y);
	Obj_SetSpeed(obj,speed);
	Obj_SetAngle(obj,angle);
	ObjShot_SetDamage(obj,damage);
	ObjShot_SetPenetration(obj,1);
	ObjShot_SetGraphic(obj,Type+1);
	Obj_SetAlpha(obj,100);

	let R;
	let G;
	let B;

	alternative(Type)
	case(0){R=127;G=255;B=127;}
	case(1){R=127;G=127;B=255;}
	case(2){R=255;G=64;B=64;}
	case(3){R=ColorRed;G=ColorGreen;B=ColorBlue;}

	if(Type==3)
	{
	DummyShot(obj,x,y,speed,angle,R,G,B);
	Obj_SetAlpha(obj,0);
	}

	ObjShot_SetDamage(obj,damage);
	if(LightMode==1){return;}
	while(!Obj_BeDeleted(obj))
	{
		if(Obj_IsIntersected(obj))
		{
		ShotHit(Obj_GetX(obj)+speed/2*cos(angle),Obj_GetY(obj)+speed/2*sin(angle),angle,2, speed / 6,R,G,B);
		}
		yield;
	}
}

task DummyShot(obj,x,y,speed,angle,R,G,B)
{
	let objE = Obj_Create(OBJ_EFFECT);
	ObjEffect_SetTexture(objE, imgShot3);
	ObjEffect_SetPrimitiveType(objE, PRIMITIVE_TRIANGLEFAN);
	Obj_SetPosition(objE,x,y);
	Obj_SetSpeed(objE,speed);
	Obj_SetAngle(objE,angle);
	ObjEffect_CreateVertex(objE, 4);
	ObjEffect_SetRenderState(objE,ADD);
	ObjEffect_SetLayer(objE,2);
	
	ObjEffect_SetVertexXY(objE, 0, -4, -32);
	ObjEffect_SetVertexXY(objE, 1, 4, -32);
	ObjEffect_SetVertexXY(objE, 2, 4, 32);
	ObjEffect_SetVertexXY(objE, 3, -4, 32);

	ObjEffect_SetVertexUV(objE, 0, 20, 0);
	ObjEffect_SetVertexUV(objE, 1, 28, 0);
	ObjEffect_SetVertexUV(objE, 2, 28, 64);
	ObjEffect_SetVertexUV(objE, 3, 20, 64);

	ObjEffect_SetScale(objE,1.1*2.5,0.8*2.5);
	ObjEffect_SetAngle(objE,0,0,angle+90);

	ascent(i in 0..4)
	{
		ObjEffect_SetVertexColor(objE, i,50, R, G, B);
	}
	while(!Obj_BeDeleted(obj))
	{
		yield;
	}
	Obj_Delete(objE);
}

task ShotHit(let x, let y, let angle, let vang, let speed,R,G,B)
{
	let obj = Obj_Create(OBJ_EFFECT);
	ObjEffect_SetTexture(obj, imgShot3);
	ObjEffect_SetPrimitiveType(obj, PRIMITIVE_TRIANGLEFAN);
	ObjEffect_CreateVertex(obj, 4);
	ObjEffect_SetRenderState(obj,ADD);
	ObjEffect_SetLayer(obj,2);
	
	ObjEffect_SetVertexXY(obj, 0, -8, -32);
	ObjEffect_SetVertexXY(obj, 1, 8, -32);
	ObjEffect_SetVertexXY(obj, 2, 8, 32);
	ObjEffect_SetVertexXY(obj, 3, -8, 32);

	ObjEffect_SetVertexUV(obj, 0, 240, 180);
	ObjEffect_SetVertexUV(obj, 1, 256, 180);
	ObjEffect_SetVertexUV(obj, 2, 256, 244);
	ObjEffect_SetVertexUV(obj, 3, 240, 244);

	ObjEffect_SetAngle(obj,0,0,angle+90);

	let Alpha = 200;
	let count = 0;
	while(Alpha > 0)
	{
		Obj_SetPosition(obj, x+speed*count*cos(angle), y+speed*count*sin(angle));
		Alpha-=15;
		count++;
		yield;
		ascent(i in 0..4){ObjEffect_SetVertexColor(obj, i, Alpha,R,G,B);}
	}
	Obj_Delete(obj);
}
